<?php

$html = '';

// Process information messages
foreach ($data as $type => $messages)
    for ($i = 0, $imax = count($messages); $i < $imax; $i++)
        $html .= '<p class="'.$type.'">'.$messages[$i].'</a>';

// Only add the div tag is there are some messages        
if (strlen($html) > 0)
    $html = '<div id="messages">'.$html.'</div>';

return $html;

?>